vim.cmd [[
  augroup _general_settings
    autocmd!
    autocmd FileType qf,help,man,lspinfo nnoremap <silent> <buffer> q :close<CR> 
    autocmd TextYankPost * silent!lua require('vim.highlight').on_yank({higroup = 'Visual', timeout = 200}) 
    autocmd BufWinEnter * :set formatoptions-=cro
    autocmd FileType qf set nobuflisted
  augroup end

  augroup _git
    autocmd!
    autocmd FileType gitcommit setlocal wrap
    autocmd FileType gitcommit setlocal spell
  augroup end

  augroup _markdown
    autocmd!
    autocmd FileType markdown setlocal wrap
    autocmd FileType markdown setlocal spell
  augroup end

  augroup _auto_resize
    autocmd!
    autocmd VimResized * tabdo wincmd = 
  augroup end

  augroup _alpha
    autocmd!
    autocmd User AlphaReady set showtabline=0 | autocmd BufUnload <buffer> set showtabline=2
  augroup end

  autocmd BufWinEnter quickfix nnoremap <silent> <buffer>
  \   q :cclose<cr>:lclose<cr>
  autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) |
  \   bd|
  \   q | endif
  autocmd FileType jsp call JspFileTypeInit()
  autocmd BufRead,BufNewFile *.ets setfiletype typescript
  autocmd BufRead,BufNewFile *.pp setfiletype puppet
  autocmd BufRead,BufNewFile *.cfg set ft=json
  autocmd BufRead,BufNewFile ohos.build setfiletype json
  autocmd BufEnter,WinEnter,InsertLeave * setl cursorline
  autocmd BufLeave,WinLeave,InsertEnter * setl nocursorline
  autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file
  autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full)
  autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file.
  autocmd FileType text setlocal textwidth=78 " for all text files set 'textwidth' to 78 characters.
  autocmd FileType c,cpp,cs,swig set nomodeline " this will avoid bug in my project with namespace ex, the vim will tree ex:: as modeline.
  "autocmd FileType c set colorcolumn=80
  "autocmd FileType c,cpp set colorcolumn=120
  autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f://
  autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f:///,f://
  autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",f:\"
  autocmd FileType lua set comments=f:--
  autocmd FileType vim setlocal foldmethod=marker
  autocmd BufNewFile,BufRead Android.bp :setl ft=go sw=4 sts=4 et

  autocmd BufReadPost * if line("'\"") > 0 && line ("'\"") <= line("$") |exe "normal g'\"" |endif
  autocmd BufNewFile,Bufread *.S set ft=arm64asm
  autocmd BufNewFile,Bufread *.s set ft=arm64asm
]]

-- Autoformat
-- augroup _lsp
--   autocmd!
--   autocmd BufWritePre * lua vim.lsp.buf.formatting()
-- augroup end
